package com.jp.knowledge.activity;

import android.content.Intent;
import android.view.View;

import com.jp.knowledge.R;

/**
 * Created by 528787067@qq.com on 2017/3/20.
 */

public class AttentionListDetailInfo extends AttentionGroupDetailInfo {
    @Override
    protected void init() {
        super.init();
        pageFragments.remove(pageFragments.size()-1);
        viewPager.getAdapter().notifyDataSetChanged();
        tabLayout.getTabAt(0).setText("动态");
        tabLayout.getTabAt(1).setText("统计");
        viewPager.setOnPageChangeListener(null);
    }

    @Override
    protected void initTitleBar() {
        super.initTitleBar();
        rightIcon.setVisibility(View.VISIBLE);
        if(type == 3)
            rightIcon.setImageResource(R.mipmap.attention_companyanalysis_leida);
        else if(type == 4)
            rightIcon.setImageResource(R.mipmap.attention_characteranalysis_leida);
        else if(type == 8)
            rightIcon.setImageResource(R.mipmap.attention_chanpin_leida);
        else
            rightIcon.setImageResource(R.mipmap.attention_productdetails);
        rightIcon.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if(v.getId() == R.id.icon_serach){
            if(type == 3)           // 公司
                JpApplicationWebActivity.gotoWebActivity(this,
                        "details/companyDetails?id=" + id+ "&type=" + type);
            else if(type == 4)      // 人物
                JpApplicationWebActivity.gotoWebActivity(this,
                        "details/figureDetails?id=" + id + "&type=" + type);
            else if(type == 8)      // 产品
                JpApplicationWebActivity.gotoWebActivity(this,
                        "details/productDetails?id=" + id + "&type=" + type);
            else
                startActivity(new Intent(mContext, SearchAttentionActivity.class)
                        .putExtra("groupId", id));
        } else{
            super.onClick(v);
        }
    }
}
